home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac-Source 1994 July
/
Mac-Source_July_1994.iso
/
Other Langs
/
MacPerl ƒ
/
Perl Source ƒ
/
MacPerl
/
MPGlobals.h
< prev
next >
Wrap
Text File
|
1993-12-18
|
6KB
|
294 lines
/*********************************************************************
Project : MacPerl - Real Perl Application
File : MPGlobals.h -
Author : Matthias Neeracher
A lot of this code is borrowed from 7Edit written by
Apple Developer Support UK
Started : 17Mar93 Language : MPW C
Modified : 29May93 MN Compiles correctly
29May93 MN Support console windows
05Aug93 MN Small icons
17Aug93 MN LibraryPaths
12Dec93 MN PerlPrefs, SacrificalGoat
Last : 12Dec93
*********************************************************************/
#ifndef __MPGLOBALS__
#define __MPGLOBALS__
#include <Types.h>
#include <QuickDraw.h>
#include <Menus.h>
#include <Editions.h>
#include <Printing.h>
#include <AppleEvents.h>
#include "MPRsrc.h"
#ifndef EXTERN
#define EXTERN extern
#endif
#define LibraryPaths 128
/*
Items in Apple Menu
*/
#define aboutItem 1
/*
Items in File Menu
*/
#define fmNew 1
#define fmOpen 2
#define fmClose 4
#define fmSave 5
#define fmSaveAs 6
#define fmRevert 7
#define fmPageSetUp 9
#define fmPrint 10
#define fmQuit 12
/*
Items in Edit Menu
*/
#define undoCommand 1
#define cutCommand 3
#define copyCommand 4
#define pasteCommand 5
#define clearCommand 6
#define selectAllCommand 7
#define emFormat 9
#ifndef RUNTIME
#define cPublisher 11
#define cSubscriber 12
#define cOptions 13
#define cBorders 14
#define emPreferences 16
#else
#define emPreferences 11
#endif
/*
Items in Perl Menu
*/
#define pmRun 1
#define pmRunFront 2
#ifndef RUNTIME
/*
Item in Help Menu
*/
#define hmExplain 5
#endif
/*
Entry of Menu in myMenus
*/
#define appleM 0
#define fileM 1
#define editM 2
#define windowM 3
#define perlM 4
#ifndef RUNTIME
#define helpM 5
#define kLastMenu 5
#else
#define kLastMenu 4
#endif
/*
Save Changes Dialog Items
*/
#define aaSave 1
#define aaDiscard 2
#define aaCancel 3
#define kOSEvent app4Evt /*event used by MultiFinder*/
#define kSuspendResumeMessage 1 /*high byte of suspend/resume event message*/
#define kResumeMask 1 /*bit of message field for resume vs. suspend*/
#define kMouseMovedMessage 0xFA /*high byte of mouse-moved event message*/
#define kNoEvents 0 /*no events mask*/
/* How much memory to set aside for emergencies */
#define SACRIFICE 32768
/* File too bulky for TextEdit */
#define elvisErr 666
/*
this is a section record to hold the information about
the publishers and subscribers in this document
*/
struct SectRec {
SectionHandle fSectHandle;
short fSectionID;
RgnHandle fBorderRgn; /*handle to the outside border*/
Rect fInnerBounds;
short fStart; /*fStart and fEnd are both specific to a*/
short fEnd; /*text handling application- start and end of text selection*/
struct SectRec **fNextSection;
FSSpec fFSSpec;
short fCount;
Handle fTextHandle;
Boolean fChanged; /*has the section been changed*/
struct DocRec *fDocument;
};
typedef struct SectRec SectRec;
typedef SectRec *SectPtr, **SectHandle;
typedef enum {
kDocumentWindow,
kWorksheetWindow,
kConsoleWindow
} WindowKind;
typedef struct RegularDoc {
Boolean showBorders;
Boolean everSaved;
SectHandle firstSection; /*the first section in the list*/
SectHandle lastSection; /*the last section*/
short numSections;
short lastID; /*the last sectionID*/
} RegularDoc;
struct DocRec;
typedef struct ConsoleDoc {
struct DocRec *next;
Ptr cookie;
short memory;
short fence;
Boolean selected;
} ConsoleDoc;
enum {
stateConsole = 0x0001,
stateDocument= 0x0002,
stateRdWr = 0x0010,
stateRdOnly = 0x0020,
stateBlocked = 0x0030
};
typedef enum {
kPreferenceDoc = -1,
kUnknownDoc,
kPlainTextDoc,
kScriptDoc,
kRuntime6Doc,
kRuntime7Doc,
kOldRuntime6Doc
} DocType;
struct DocRec {
TEHandle theText;
ControlHandle vScrollBar;
ControlHandle hScrollBar;
WindowPtr theWindow;
short refNum;
short lastState;
Str255 theFileName;
FSSpec theFSSpec;
THPrint thePrintSetup;
Rect pageSize; /*From thePrintSetUp^^.prInfo.rPage but 0 offset*/
Boolean dirty;
DocType type;
WindowKind kind;
union {
RegularDoc reg;
ConsoleDoc cons;
} u;
};
typedef struct DocRec DocRec;
typedef DocRec *DPtr;
struct HeaderRec {
Rect theRect;
Str255 theFont;
short theSize;
short theLength;
short numSections;
short lastID;
};
typedef struct HeaderRec HeaderRec;
typedef HeaderRec *HPtr, **HHandle;
struct DocFormat {
short font;
short size;
};
typedef struct DocFormat DocFormat;
struct PerlPrefs {
short version;
#define PerlPrefVersion411 0
Boolean runFinderOpens;
Boolean checkType;
};
typedef struct PerlPrefs PerlPrefs;
EXTERN short gWCount;
EXTERN short gNewDocCount;
EXTERN MenuHandle myMenus[kLastMenu+1];
EXTERN short gFontMItem;
EXTERN Boolean gQuitting;
EXTERN Cursor editCursor;
EXTERN Cursor waitCursor;
EXTERN Boolean gInBackground;
EXTERN Boolean gRunningPerl;
EXTERN DPtr gConsoleList;
EXTERN short gPrefsFile;
EXTERN short gScriptFile;
EXTERN WindowPtr gActiveWindow;
EXTERN short gAppFile;
EXTERN short gAppVol;
EXTERN long gAppDir;
EXTERN DocFormat gFormat;
EXTERN Handle gRuntimeScript;
EXTERN Handle gPseudoFile;
EXTERN AppleEvent *** gWaitingScripts;
EXTERN DPtr gGotEof;
EXTERN PerlPrefs gPerlPrefs;
EXTERN Handle gSacrificialGoat;
/*now for the environment variables set up by Gestalt*/
EXTERN Boolean gAppleEventsImplemented;
#ifndef RUNTIME
EXTERN Boolean gAliasManagerImplemented;
EXTERN Boolean gEditionManagerImplemented;
EXTERN Boolean gOutlineFontsImplemented;
EXTERN Boolean gRecordingImplemented;
#endif
#endif